package com.jhgk.jhcee.expert.controller;

import com.github.pagehelper.PageInfo;
import com.jhgk.jhcee.auth.model.ScoreWc;
import com.jhgk.jhcee.common.resultful.BasisResultful;
import com.jhgk.jhcee.common.resultful.PageResultful;
import com.jhgk.jhcee.expert.domain.model.ScoreWcModel;
import com.jhgk.jhcee.expert.service.ScoreWcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: xiezhongping
 * @description:
 * @date: 2021/8/13 11:46.
 */
@RestController
@RequestMapping("/ScoreWc")
@Api(value = "位次",tags = {"位次"})
public class ScoreWcController {

    @Resource(name = "ScoreWcServiceImpl")
    ScoreWcService scoreWcService;

    @PostMapping("/searchAllPage")
    @ApiOperation("分页查询")
    public PageResultful<PageInfo<ScoreWc>> searchAllPage(@RequestBody @Validated ScoreWcModel scoreWcModel) {
        return scoreWcService.searchAllPage(scoreWcModel);
    }

    @PostMapping("/addBatch")
    @ApiOperation("批量新增")
    public BasisResultful<Object> addBatch(@RequestBody @Validated List<ScoreWc> scoreWcs) {
        return scoreWcService.addBatch(scoreWcs);
    }

    @PutMapping("/updateBatch")
    @ApiOperation("批量更新")
    public BasisResultful<Object> updateBatch(@RequestBody @Validated List<ScoreWc> scoreWcs) {
        return scoreWcService.updateBatch(scoreWcs);
    }

    @DeleteMapping("/delete")
    @ApiOperation("删除位次信息")
    public BasisResultful<Object> delete(@RequestBody @Validated ScoreWc scoreWc) {
        return scoreWcService.delete(scoreWc);
    }
}
